package com.od.controller;

import com.od.service.DeliveryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

import java.util.List;
import java.util.Map;

@Controller
@RequestMapping("delivery")
@CrossOrigin
public class DeliveryController {
    @Autowired
    private DeliveryService deliveryService;

    @PostMapping("selectByEnterpriseId")
    @ResponseBody
    public List<Map<String, Object>> selectByEnterpriseId(@RequestBody Map<String, Object> deliveryData){
        System.out.println(deliveryData.get("interviewEnterprise").toString());
        return deliveryService.getDeliveryInfo(deliveryData.get("interviewEnterprise").toString());
    }

    @RequestMapping(value = "getAllDeliveryById", method = RequestMethod.POST)
    @ResponseBody
    public List<Map<String, Object>> getAllDeliveryById(@RequestBody Map<String, Object> seekerData) {
        Integer seekerId = (Integer) seekerData.get("seekerId");
        System.out.println(seekerId);
        return deliveryService.getAllDeliveryById(seekerId);
    }


}
